<%@page import="custom.Message"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Conversation</title>
</head>
<body>
	<%@ include file="header.jsp" %>
	<%
		int hesId = Integer.parseInt(request.getParameter("id"));
		User user = (User) session.getAttribute("user");
		ArrayList<Message> messages = Message.getConversationWith(user.getId(), hesId);
	%>
	
	<center><div style="width: 800px;" align="left">
		<div style="font-style: italic; font-weight: 800;">Conversation with <%= User.getNameHtml(hesId) %></div>
		
		<%	for(int i=0; i< messages.size(); i++)
				out.print(messages.get(i).getHtml());
		%>
		
		<form action="SendMessageServlet" method="post">
			<input type="hidden" name="from" value="<%=user.getId() %>" />
			<input type="hidden" name="to" value="<%=hesId %>" />
			<input type="text" name="msgText" value=""/>
			<input type="submit" value="send" />
		</form></div>

	</div></center>
	
</body>
</html>